<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script>
    function classChange(inputId1) {
    var inputValue = $.trim($("#" + inputId1).val());
    if (inputValue == 'A' || inputValue == 'B') {
        toastr.error('药品类价表是在药品管理系统中维护,请选择其他类别!');
        $('#' + inputId1).val('');
        $("#s2id_itemClass .select2-chosen").html('');
        return false;
    }
}
    function changePrice(inputId,inputId2){
        var inputValue = $.trim($("#"+inputId).val());
        if(inputValue!=null&&inputValue!=''){
            $("#"+inputId2).val(inputValue);
        }

    }
</script>
<div class="content-wrap">
        <div class="wrapper" style="bottom: 50px;">
            <ul class="nav nav-tabs">
                <li>
                    <a href="#"  onclick="loadDiv('mainCenterDiv','${ctx}/oper/priceList/index')">价表列表</a>
                </li>
                <li class="active">
                    <a href="#" onclick="loadDiv('mainCenterDiv','${ctx}/oper/priceList/form')">
                        <c:choose>
                            <c:when test="${priceList.id==''|| priceList.id==null}">
                                价表添加
                            </c:when>
                            <c:otherwise>价表修改</c:otherwise>
                        </c:choose>
                    </a>
                </li>
            </ul>
            <section class="panel panel-default">
                <div class="panel-body">
                    <div class="col-lg-12">
                        <form:form id="inputForm" data-parsley-validate="" modelAttribute="priceList" onsubmit="return formSaveLoad('mainCenterDiv','inputForm','${ctx}/oper/priceList/save','${ctx}/oper/priceList/index');" method="post" class="form-horizontal">
                            <form:hidden path="id"/>
                            <form:hidden path="orgId"/>

                                <div class="col-lg-6">
                                    <c:if test="${priceList ==null|| priceList.id==null || priceList==''}">
                                        <div class="form-group">
                                            <label class="col-sm-5 control-label"><input type="checkbox" name="mark" value="1">生成诊疗项目</label>
                                        </div>
                                    </c:if>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">项目分类：</label>
                                        <div class="col-sm-6">
                                            <form:select path="itemClass" id="itemClass" class="form-control" data-parsley-required="true" onchange="return classChange('itemClass','')">
                                                <form:option value="" label=""/>
                                                <form:options items="${fns:getDictList('BILL_ITEM_CLASS_DICT')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
                                            </form:select>
                                        </div>
                                    </div>
                                    <%--<div class="form-group">--%>
                                        <%--<label class="col-sm-4 control-label">项目代码：</label>--%>
                                        <%--<div class="col-sm-6">--%>
                                            <%--<form:input path="itemCode" id="itemCode" htmlEscape="false" class="form-control"  maxlength="50" data-parsley-required="true" />--%>
                                        <%--</div>--%>
                                    <%--</div>--%>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">项目名称：</label>
                                        <div class="col-sm-6">
                                            <form:input path="itemName" htmlEscape="false" class="form-control"  maxlength="200" data-parsley-required="true"/>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">项目规格：</label>
                                        <div class="col-sm-6">
                                            <form:input path="itemSpec" htmlEscape="false" class="form-control"  maxlength="100" data-parsley-required="true"/>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">单位：</label>
                                        <div class="col-sm-6">
                                            <form:select path="units" class="form-control" data-parsley-required="true">
                                                <form:option value="" label=""/>
                                                <form:options items="${fns:getDictList('SPEC_UNIT')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
                                            </form:select>

                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">价格：</label>
                                        <div class="col-sm-6">
                                            <c:choose>
                                                <c:when test="${priceList.id!=null&&priceList.id!=''}">
                                                    <form:input path="price" id="price" htmlEscape="false" class="form-control" data-parsley-required="true" data-parsley-twonum="1" onblur="return changePrice('price','preferPrice');"  readonly="true"/>
                                                </c:when>
                                                <c:otherwise>
                                                    <form:input path="price" id="price" htmlEscape="false" class="form-control" data-parsley-required="true" data-parsley-twonum="1" onblur="return changePrice('price','preferPrice');"  />
                                                </c:otherwise>
                                            </c:choose>
                                        </div>
                                    </div>
                                    <div class="form-group display-none">
                                        <label class="col-sm-4 control-label">优惠价格：</label>
                                        <div class="col-sm-6">
                                            <c:choose>
                                            <c:when test="${priceList.id!=null&&priceList.id!=''}">
                                                <form:input path="preferPrice" id="preferPrice" htmlEscape="false" class="form-control"  data-parsley-twonum="1" readonly="true"/>
                                            </c:when>
                                            <c:otherwise>
                                                <form:input path="preferPrice" id="preferPrice" htmlEscape="false" class="form-control"  data-parsley-twonum="1"/>
                                            </c:otherwise>
                                            </c:choose>

                                        </div>
                                    </div>

                                </div>
                                <div class="col-lg-6">
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">开始时间：</label>
                                        <div class="col-sm-6">
                                            <input name="startDate" htmlEscape="false" class="form-control Wdate" data-parsley-required="true" readonly onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'%y-%M-%d %H:%m:%s'})" value='<fmt:formatDate value="${priceList.startDate}" pattern="yyyy-MM-dd HH:mm:ss"/>'/>

                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">费用分类：</label>
                                        <div class="col-sm-6">
                                            <form:select path="classOnRcpt" class="form-control" data-parsley-required="true">
                                                <form:option value="" label=""/>
                                                <form:options items="${fns:getDictList('OUTP_RCPT_FEE_DICT')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
                                            </form:select>
                                                <%-- <form:input path="classOnRcpt" htmlEscape="false" class="form-control"  maxlength="10" />--%>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">核算项目分类：</label>
                                        <div class="col-sm-6">
                                            <form:select path="classOnReckoning" class="form-control" data-parsley-required="true">
                                                <form:option value="" label=""/>
                                                <form:options items="${fns:getDictList('RECK_ITEM_CLASS_DICT')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
                                            </form:select>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">会计科目：</label>
                                        <div class="col-sm-6">
                                            <form:select path="subjCode" class="form-control" data-parsley-required="true">
                                                <form:option value="" label=""/>
                                                <form:options items="${fns:getDictList('TALLY_SUBJECT_DICT')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
                                            </form:select>

                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">病案首页分类：</label>
                                        <div class="col-sm-6">
                                            <form:select path="classOnMr" class="form-control" data-parsley-required="true">
                                                <form:option value="" label=""/>
                                                <form:options items="${fns:getDictList('MR_FEE_CLASS_DICT')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
                                            </form:select>

                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">备注信息：</label>
                                        <div class="col-sm-6">
                                            <form:textarea path="remarks" htmlEscape="false" rows="3" maxlength="200" class="form-control"/>
                                        </div>
                                    </div>

                                </div>

                            <div class="form-group">
                                <div class="col-sm-offset-2 col-sm-10">
                                    <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存">&nbsp;
                                    <input id="btnCancel" class="btn" type="button" value="返 回" onclick="loadDiv('mainCenterDiv','${ctx}/oper/priceList/index')">
                                </div>
                            </div>

                        </form:form>
                    </div>

                </div>
            </section>
        </div>
    </div>